USE [WarehouseManagement]
GO
/****** Object:  StoredProcedure [dbo].[[CheckIfUsernameExists]]    Script Date: 04/09/2011 00:46:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		AnhDQ
-- Create date: 3/22/2011
-- Description:	This stored procedure use to delete an Employee record
-- =============================================
CREATE PROCEDURE [dbo].[CheckIfUsernameExists]
(
	@Username nvarchar(50) = NULL
)
AS
BEGIN
	
	IF (EXISTS (SELECT 1 FROM [Employee] WHERE [Username] = @Username))
	BEGIN
		SELECT 1 AS 'EXISTS'
	END
	ELSE
	BEGIN
		SELECT 0 AS 'EXISTS'
	END
END

/*
USE WarehouseManagement
GO

EXEC [CheckIfUsernameExists] 4
*/